package models;

import java.util.GregorianCalendar;

import javax.xml.bind.annotation.XmlTransient;

public class HistoryElement
implements Comparable<HistoryElement>{

	GregorianCalendar datetime;
	double userrating;
	double correctness;
	double calcedrating;
	
	@XmlTransient
	Question q;
	
	private HistoryElement(){
		
	}
	
	public HistoryElement(Question q){
		this();
		this.q = q;
	} 
	
	public HistoryElement(Question q, GregorianCalendar datetime,
			double userrating, double correctness, double calcedrating){
		this(q);
		this.datetime = datetime;
		this.userrating = userrating;
		this.correctness = correctness;
		this.calcedrating = calcedrating;
	}

	@Override
	public int compareTo(HistoryElement arg0) {
		if (arg0 == null) {
			return -1;
		}
		return (this.datetime.getTimeInMillis() == arg0.datetime.getTimeInMillis()) ?
				0 : 
				(this.datetime.getTimeInMillis() < arg0.datetime.getTimeInMillis()) ?
						-1 : 1;
		
	}
	
	
}
